/*
    created：2023/4/19
    filename: Main.cpp
    author: 李东霖
    purpose：Composite组合模式的演示代码
*/

#include"Composite.h"
int main()
{

    Leaf *pLeaf1 = new Leaf();
    Leaf *pLeaf2 = new Leaf();

    Composite* pComposite = new Composite;
    pComposite->Add(pLeaf1);
    pComposite->Add(pLeaf2);
    pComposite->Operation();

    pComposite->GetChild(2)->Operation();
    delete pComposite;
    return 0;
}